<script>
export default {
    props:{
        type:{
            type:String,
            required:true,
            default:'before'
        },
        fieldCfg:{
            type:Object,
            requried:true,
            default(){
                return {}
            },
        },
        after:{
            requried:true,
            default:null
        },
        before:{
            requried:true,
            default:null
        }
    },
    methods:{
        toEmployeeProfile() {
            const employee = this.type === 'before' ? this.before : this.after
            this.$router.push({
                path: `/personnel-files/show/${employee.id}`,
                query: { tag_title: employee.name + '-查看', show: true }
            })
        }
    },
    computed:{
        text(){
            return this.type === 'before' ? this.before.name : this.after.name
        }
    }
}
</script>

<template>
    <el-button type="text" @click="toEmployeeProfile">{{ text }}</el-button>
</template>